<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<section class="content-header">
    <h1>
        项目剩余原料量
    </h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <!--查询条件-->
                    <form id="queryForm">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>项目编号</label>
                                    <input type="text" name="ityProCode"
                                           class="form-control"
                                           placeholder="请输入项目编号" autocomplete="off">
                                </div>
                                <div class="form-group">
                                    <label>项目名称</label>
                                    <input type="text" name="ityProName"
                                           class="form-control"
                                           placeholder="请输入项目名称" autocomplete="off">
                                </div>
                                <button type="button" class="btn btn-success" id="btn_search">搜索</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var table;

    $(function () {

        /** 加载列表 */
        table = js.table.init({
            url: ctx + "material/reportForms/matResidueList",
            pageSize: 300,
            showColumns: true,
            columns: [
                {
                    title: '序号', field: 'odaId', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: '项目编码', field: 'ityProCode'},
                {title: '项目名称', field: 'ityProName'},
                {title: '项目数量', field: 'proNum'},
                {title: '剩余重量<br>（吨）', field: 'ityWeightSum'},
                {
                    title: '剩余金额<br>（元）', field: 'ityAmountSum',
                    formatter: function (value, row, index) {
                        if (hasP("overview:amount:view")) {
                            if (value == undefined || value == null || value == 0) {
                                return "--"
                            } else {
                                return value;
                            }
                        } else {
                            return '***';
                        }
                    }
                },
                {
                    title: '操作', width: '110',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="' + ctx + 'matInvManage/complex/page/' + row.ityProCode + '" >查看</a>');
                        return actions.join('');
                    }
                }
            ]
        });

        /** 表格搜索 */
        $("#btn_search").click(function () {
            js.table.search(table);
        });

    })
</script>
</body>
</html>